from selenium import webdriver
from selenium.webdriver.common.by import By
import time

d = webdriver.Chrome()
d.get('https://www.baidu.com')

# 获取 标题
print( d.title )
# 获取 当前窗口的网址
print( d.current_url )

# 获取 属性对应的值  get_attribute('属性名称') 获取该属性对应的值
button_ele = d.find_element(By.CSS_SELECTOR,'[id="su"]')
res = button_ele.get_attribute('class')
print(res)

# 获取 文本信息  .text 获取 该元素的 文本信息
link_ele = d.find_element(By.CSS_SELECTOR,'[class="title-content-title"]')
res2 = link_ele.text
print(res2)

